{template 'common/header'}
<div class="main">
	<ul class="nav nav-tabs">
		<li{if $_GPC['do'] == 'admanage' || $_GPC['do'] == '' } class="active"{/if}><a href="{php echo $this->createWebUrl('admanage');}">广告管理</a></li>
        <!-- <li{if $_GPC['do'] == 'post'} class="active"{/if}><a class="btn-lg" data-toggle="modal" data-target="#myModal">添加微信卡券</a></li> -->
	</ul>

	<!-- Modal -->
	

	<div class="panel panel-default">
		<div class="panel-body">
		<form action="" method="post" class=" form" enctype="multipart/form-data">
			<div class="form-group">
				<label class="control-label">广告图片</label>
				<div>
					{php echo tpl_form_field_image('adlogo',$addad['adlogo']);}
					<div class="help-block">广告显示图片 图片大小640px X 380px</div>
				</div>
			</div>

			<div class="form-group">
				<label for="adtitle" class="control-label">广告标题:</label>
				<input type="text" class="form-control" name="adtitle" value="">
			</div>

			<div class="form-group">
				<label for="addetails" class="control-label">广告简介:</label>
				<input type="text" class="form-control" name="addetails" value="">
				<div class="help-block">简单的广告介绍!</div>
			</div>
			<div class="form-group">
				<label for="adlink" class="control-label">广告链接:</label>
				<input type="text" class="form-control" name="adlink" value="">
				<div class="help-block">广告的链接地址!格式：http://www.baidu.com</div>
			</div>
			<div class="form-group">
				<label class="control-label">适用规则</label>
				<div class="">
					<select name="rulename" class="form-control" required="required" id="rulename">
						{loop $rowlist $row}
						<option value="{$row['id']}">{$row['name']}</option>
						{/loop}
					</select>
				</div>
			</div>
			<div class="form-group col-sm-12">
            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
            <input type="hidden" name="op" value="addad" />
        	</div>
		</div>
	</div>
	</form>

</div>
<!-- <div id="queding" class="hide">
	<span class="pull-right btn btn-primary" id="chengaddd" onclick="abc()">确定</span>
</div> -->
<script>
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});


$(function(){

    $(".check_all").click(function(){
       var checked = $(this).get(0).checked;

       $("input[type=checkbox]").attr("checked",checked);
    });
	$("input[name=deleteall]").click(function(){
		var check = $("input:checked");

		if(check.length<2){
			alert('请选择要删除的记录!');
			return false;
		}
        if( confirm("确认要删除选择的记录?")){
		var id = new Array();
		check.each(function(i){
			id[i] = $(this).val();
		});
		$.post('{php echo $this->createWebUrl('deleteAllcard')}', {idArr:id},function(data){
			if (data.errno ==0)
			{
				location.reload();
			} else {
				alert(data.error);
			}


		},'json');
		}

	});
});
</script>
<script>
function drop_confirm(msg, url){
    if(confirm(msg)){
        window.location = url;
    }
}
</script>
{template 'common/footer'}